#include "sceneobject.h"

SceneObject::SceneObject(float gravityFactor,float randomnessFactor,float walkingSpeedFactor,int effectDurationMs,
                         float xPos,float yPos,float objWidth,QString resourceId){
    this->resourceId=resourceId;
    this->gravityFactor=gravityFactor;
    this->randomnessFactor=randomnessFactor;
    this->walkingSpeedFactor=walkingSpeedFactor;
    this->effectDuration=effectDurationMs;

    this->xPosition=xPos;
    this->yPosition=yPos;

    this->width=objWidth;

    this->expiresAt=0;
}

SceneObject::~SceneObject(){
    if(expiresAt!=0)
        delete expiresAt;
}

void SceneObject::activate(){
    expiresAt=new QTime;
    *expiresAt=QTime::currentTime().addMSecs(effectDuration);
}

QTime* SceneObject::getExpiresAt(){
    return expiresAt;
}

int SceneObject::getEffectDuration(){
    return effectDuration;
}

float SceneObject::getWalkingSpeedFactor(){
    return walkingSpeedFactor;
}

float SceneObject::getRandomnessFactor(){
    return randomnessFactor;
}

float SceneObject::getGravityFactor(){
    return gravityFactor;
}

float SceneObject::getXPosition(){
    return xPosition;
}

float SceneObject::getYPosition(){
    return yPosition;
}

float SceneObject::getWidth(){
    return width;
}

QString SceneObject::getResourceId(){
    return resourceId;
}
